package com.codeforces.contest.c279;

import java.util.Scanner;

public class _279B {

	static Scanner scanner = new Scanner(System.in);
	static int n, t;
	static int[] num;

	public static void main(String[] args) {
		n = scanner.nextInt();
		t = scanner.nextInt();
		num = new int[n+1];
		for (int i=1;i<=n;++i) {
			num[i] = scanner.nextInt();
		}
		int len = 0;
		int end = 1;
		int sum = 0;
		for (int i=1;i<=n;++i) {
			if (end > n) {
				break;
			}
			sum += num[end];
			while (sum <= t && end < n) {
				end++;
				sum += num[end];
			}
			if (sum > t) {
				if (end - i > len) {
					len = end - i;
				}
				while (sum > t) {
					sum -= num[i];
					i++;
				}
				--i;
				end++;
			}
			else {
				if (end - i + 1> len) {
					len = end - i + 1;
					break;
				}
			}
		}
		System.out.println(len);
	}

}
